﻿<%@ Register TagPrefix="cc1" Namespace="Mysoft.PubProject.Business" Assembly="Mysoft.PubProject.Business" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Khgj_Work.aspx.vb" Inherits="Slxt.Khgj_Work"%>
<%@ Register TagPrefix="cnt" Namespace="Mysoft.Map.Application.Controls" Assembly="Mysoft.Map.Application.Components" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>客户来访统计</title>
		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1" />
		<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1" />
		<meta name="vs_defaultClientScript" content="JavaScript" />
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
        <script language="javascript" type="text/javascript" src="/_controls/settings.aspx"></script>
		<link rel="stylesheet" type="text/css" href="/_grid/map_grid.css" />
		<link rel="stylesheet" type="text/css" href="/_common/styles/global.css" />
		<link rel="stylesheet" type="text/css" href="/_nav/taskbox.css" />
		<link rel="stylesheet" type="text/css" href="/_nav/menu.css" />
		<link rel="stylesheet" type="text/css" href="/_forms/styles/form.css" />
		<link rel="stylesheet" type="text/css" href="/_controls/find/find.css" />  
        <!-- select -->
        <link rel="stylesheet" type="text/css" href="/MyWorkflow/css/form.css" />

        <script language="javascript" type="text/javascript" src="/_common/scripts/global.js"></script>

        <script language="javascript" type="text/javascript" src="/_controls/find/find.js"></script>

        <script language="javascript" type="text/javascript" src="/_controls/util/util.js"></script>

        <script language="javascript" type="text/javascript" src="/_controls/datetime/date.js"></script>

        <script language="javascript" type="text/javascript" src="/Slxt/js/Public.js"></script>
		<!-- DropDownTree -->
		<link rel="stylesheet" type="text/css" href="/_controls/tree/dropdowntree.css" />
		<link rel="stylesheet" type="text/css" href="/pubproject/_controls/CRMControls/ProjDDTree.css" />
		<script language="javascript" type="text/javascript" src="/slxt/js/Public.js"></script>
        <script language="javascript" type="text/javascript" src="/slxt/XSZDH/Khgj.js"></script>
		
		<script language="javascript" type="text/javascript">
	    //在线帮助文件
		    var _MyHelpfile = "";


	    function window.onload() {
	        //设置默认值
	        //日期
	        document.getElementById("txtBgnDate").value = GetFirstDayOfMonth();
	        document.getElementById("txtEndDate").value = new Date().format();
	        
	        //校验导出权限
	        if (document.getElementById("txtIsRight").value == "1") {
	            document.getElementById("btnExport").disabled = false;
	        }
	        
	        // 查询
	        doQuery();
	    }
        
        // 查询事件
	    function doQuery(isQuery) {
	       
	        //重新过滤置业顾问
	        if (!isQuery && appProjTree.ovalue !== appProjTree.value) {
	            InitZygw();
	        }
	    	        
	        //校验条件
	        if (!vaildeFilter()) { return; }
	    
	        //选择全部置业顾问
	        //则查询置业顾问工作成果统计
	        //否则查询置业顾问工作成果明细
	        var strUserGUID = document.getElementById("cboZygw").returnValue;
	        var sel = document.getElementById("cboZygw");
	        // 置业顾问下拉框value和text相等，说明是该置业顾问不在项目团队中
	        // 则使用点击列表中置业顾问的GUID进行查询
	        if (sel.returnValue == sel.returnText) {
	            strUserGUID = document.getElementById("txtSelUserGUID").value;
	        }
	        var strTjType = "1"; //默认查询置业顾问工作成果统计
	        if (strUserGUID != "all") {
	            strTjType = "2";
	        }
	        var strProjGUID = appProjTree.value;
	        // 设置URL和参数
	        var strUrl = appIframe.frameElement.url + "?";
	        var aryParams = [];
	        aryParams.push("funcid=" + __funcid.value);
	        aryParams.push("ProjGUID=" + strProjGUID);
	        aryParams.push("UserGUID=" + strUserGUID);
	        aryParams.push("BgnDate=" + escape(document.getElementById("txtBgnDate").value + " 00:00:00.000"));
	        aryParams.push("EndDate=" + escape(document.getElementById("txtEndDate").value + " 23:59:59.997"));
	        aryParams.push("TjType=" + escape(strTjType));
	        // 连接
	        appIframe.location = strUrl + aryParams.join("&");
	        appProjTree.ovalue = appProjTree.value;
	    }
        
        //导出Excel
	    function exportExcel() {
	        // 判断加载
	        if (appIframe.document.readyState != "complete") {
	            event.returnValue = false;
	            return;
	        } else {
	            appIframe.exportExcel();
	        }

	    }

	    //根据项目不同加载相应的置业顾问
	    function InitZygw() {
	        var sPath = "/Slxt/XSZDH/Khgl_Pub_XMLHTTP.aspx?ProjGUID=" + appProjTree.value;
	        var strRtn = openXMLHTTP(sPath, "BuildAllProjUser");
	        document.getElementById("_Preferred_Table").outerHTML = strRtn;
	        document.getElementById("cboZygw").setValue("all");
	    }
		</script>
	</head>
	<body MS_POSITIONING="GridLayout" class="tab" >
		<cnt:AppLog id="appLog" runat="server" Funcid="01010214"/>
		<table style="font-size: 9pt" height="100%" border="0" cellspacing="0" cellpadding="0" width="100%">
        <tr height="1">
            <td>
                <!--查询条件--->
                <table id="tblFind" cellspacing="0" cellpadding="0" border="0" style="table-layout: fixed; width: 100%; height: 30px">
                    <colgroup>
                            <col width="50%">
                            <col />
                    </colgroup>
                    <tr height="26">
                        <td>
                            <table   width="95%" height="100%"  cellspacing="0" cellpadding="0" >
	                            <colgroup>
	                                <col width="50" />
	                                <col />
	                            </colgroup>
	                            <tr>
	                                <td>
                                        <b style="COLOR:#666666">项目</b>
                                    </td>
                                    <td>
                                        <form id="Form1" method="post" runat="server" style="display: inline">
                                        <asp:HiddenField ID="hidUserGUID" runat="server" />
                                        <asp:TextBox runat="server" ID="txtIsRight" style="DISPLAY:none"></asp:TextBox>
                                         <asp:TextBox runat="server" ID="txtSelUserGUID" style="DISPLAY:none"></asp:TextBox>
                                        <cc1:ProjDDTree2 ID="appProjTree" runat="server" DisplayHiberarchy="Project" OnQuery="doQuery()"
                                            IsSelectLastLevelOnly="True" IsSelectAll="False" ProjField="Opp.ProjGUID" ApplySys="销售管理" Width="100%" />
                                        </form>
                                    </td>   
                                </tr>
                            </table>
                        </td>
                        <td>
                             <table   width="100%" height="100%"  cellspacing="0" cellpadding="0" >
	                            <colgroup>
	                                <col width="50" />
	                                <col />
	                            </colgroup>
	                            <tr>
	                                <td>
                                        置业顾问
                                    </td>
                                    <td>
                                        <span class="selectBox" typename="mapType" name="cboZygw" id="cboZygw" value="" runat="server" style="width:50%">
                                         <table id="_Preferred_Table" cellspacing="0" cellpadding="2" style="display:none;">
								               <tr height="18">
				                                    <td nowrap val="all">--全部--</td>
				                               </tr>					
							             </table>
                                        </span>
                                    </td>  
	                            </tr>
	                            </table>
                        </td>                   
                    </tr>
                    <tr>
                        <td>
                            <table   width="95%" height="100%"  cellspacing="0" cellpadding="0" >
	                            <tr>
                                    <td width="70px">
                                        查询日期&nbsp;从
                                    </td>
                                    <td>
                                    <table width="100%" border="0" cellpadding="1" cellspacing="0" style="table-layout: fixed;"
                                        align="left">
                                        <tr>
                                            <td>
                                                <input style="width: 100%" type="text" id="txtBgnDate" name="txtBgnDate"
                                                    maptype="dtm" time="0" class="dtm" maxlength="16" value="" returnValue="">
                                            </td>
                                            <td width="37px" align="left">
                                                <img style="cursor: hand" align="middle" class="dtm" src="/_imgs/btn_off_cal.gif">
                                            </td>
                                        </tr>
                                    </table>

                                    </td>
                                     <td width="50" align="center">
                                        到
                                    </td>
                                    <td>
                                    <table width="100%" border="0" cellpadding="1" cellspacing="0" style="table-layout: fixed;"
                                        align="left">
                                        <tr>
                                            <td>
                                                <input style="width: 100%" type="text" id="txtEndDate" name="txtEndDate"
                                                    maptype="dtm" time="0" class="dtm" maxlength="16" value="" returnValue="">
                                            </td>
                                            <td width="37px" align="left">
                                                <img style="cursor: hand" align="middle" class="dtm" src="/_imgs/btn_off_cal.gif">
                                            </td>
                                        </tr>
                                    </table>
                                    </td>
	                            </tr>
	                            </table>
                        </td>
                        <td align="right">
                            <button id="btnSearch" type="button" onclick="doQuery(true)">查 询</button>&nbsp;
                            <button id="btnExport" type="button" onclick="exportExcel();" disabled="disabled">导 出</button>
                        </td>             
                    </tr>
                </table>
            </td>
        </tr>
        <tr height="10">
            <td>
            </td>
        </tr>
        <tr>
            <td>
                <iframe id="appIframe" url="Khgj_WorkDetail.aspx" width="100%" height="100%" frameborder="0"
                    scrolling="no"></iframe>

            </td>
        </tr>
    </table>
	</body>
</html>
